package org.xiao.web

import org.junit.Test

class GroovyTest {

    @Test
    void test(){

        def fun2={
             a, b->
            println a+b
        }

        fun2.call(1,2)
    }

    @Test
    void performance(){
        def begin=new Date().getTime()
        def count=10000*10000,sum=0
        for (def i=1;i<=count;i++){
            sum+=i
        }
        def end=new Date().getTime()
        println("time:${end-begin},sum:${sum}")
    }

    static int performance2(){
        def begin=new Date().getTime()
        def count=10000*10000,sum=0
        for (def i=1;i<=count;i++){
            sum+=i
        }
        def end=new Date().getTime()
        println("Groovy time:${end-begin},sum:${sum}")
        end-begin
    }
}
